<%-- 
    Document   : LuocSuMuaHang
    Created on : Oct 22, 2012, 3:06:21 PM
    Author     : KhanhNhac
--%>

<%@page import="Dao.ulti.KhachHangDAO"%>
<%@page import="Dao.ulti.SanPhamDAO"%>
<%@page import="pojo.ChiTietDonHang"%>
<%@page import="Dao.ulti.DonHangDAO"%>
<%@page import="Dao.ulti.ChiTietDonDatHangDAO"%>
<%@page import="pojo.DonHang"%>
<%@page import="pojo.SanPham"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Shoes.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body background="images/Blue_Background.png">
    <%
            ArrayList<SanPham> luocSuMuaHang;
            int Kh;
            if(request.getParameter("Kh") == null){
                Kh=1;
            }else{
                Kh=Integer.parseInt(request.getParameter("Kh"));
            }
            luocSuMuaHang = new ArrayList<SanPham>();
            ArrayList<DonHang> donHang= (ArrayList) DonHangDAO.layDonHangTheoMaKH(Kh);
            if(donHang.size()>0){
                for (int i = 0; i < donHang.size(); i++) {
                ArrayList<ChiTietDonHang> chiTietDonHang=(ArrayList) ChiTietDonDatHangDAO.layChiTietDonHangTheoMaDonHang(donHang.get(i).getMaDonHang());
                     if(chiTietDonHang.size()>0){
                         for (int j = 0; j < chiTietDonHang.size(); j++){
                             luocSuMuaHang.add(chiTietDonHang.get(j).getSanPham());
                             luocSuMuaHang.get(j).setSoLuong(chiTietDonHang.get(j).getSoLuong());
                         }
                     }                          
                }
            }
            
    %>
<table width="1034" height="455" align="center" border="1" bordercolor="#FFFFFF">
  <tr align="center">
    <td colspan="5" valign="middle"><img src="images/BannerShoes.gif" width="1024" height="247"/></td>
  </tr>
  <tr>
    <td width="200" align="center"><a href="TrangChu"><img src="images/Button-Trangchu.gif" width="179" height="48"/></a></td>
    <td width="200" align="center"><a href="TrangDangKy"><img src="images/Button-Nam.gif" width="179" height="48"/></a></td>
    <td width="200" align="center"><a href="TrangChu"><img src="images/Button-Nu.gif" width="179" height="48"/></a></td>
    <td width="200" align="center"><a href="TrangChu"><img src="images/Button-Treem.gif" width="179" height="48"/></a></td>
    <td width="200" align="center"><a href="TrangChu"><img src="images/Button-Gioithieu.gif" width="179" height="48"/></a></td>
  </tr>
  <tr align="center">
    <td colspan="5">
    <p align="right"><font color="#0066FF"><strong>Tìm kiếm theo:</strong></font>
      <select name="kichCo2" size="1" style="width:15%">
        <option value="Tất cả" selected="selected">--Chọn thương hiệu--</option>
        <option>Guicci</option>
        <option>Puma</option>
      </select>
<select name="kichCo" style="width:15%">
                        <option value="Tất cả" selected="selected">--Chọn loại--</option>
                        <option value="mã danh mục">Tên danh mục</option>
                      </select>
        <select name="kichCo" style="width:15%">
                        <option value="Tất cả" selected="selected">--Chọn kích cỡ--</option>
                        <option value="mã danh mục">Tên danh mục</option>
        </select>
         <select name="kichCo" style="width:15%">
                        <option value="Tất cả" selected="selected">--Chọn giá--</option>
                        <option value="mã danh mục">Tên danh mục</option>
        </select>
            <input type="submit" value="Tìm kiếm" name="timKiem">           
    </p></td>
  </tr>
  <tr>
    <td height="294" align="center">
    <table width="100%" height="190" cellpadding="5" cellspacing="0" background="images/background.jpg" >
              <tr>
                <td colspan="2" height="30" align="justify" valign="top" background="images/Bartop.gif"><p><strong><font color="#FFFFFF">THƯƠNG HIỆU</font></strong></p></td>
              </tr>
                <!--BatDauDanhMuc-->
              <tr>
                <td>               
                 <a href="DanhSachSanPham.jsp?maThuongHieu=1">Bitis</a></td>
              </tr> 
            </table>
    <table width="100%" background="images/background.jpg" >
      <tr>
        <td colspan="2" height="30" align="center" background="images/Bartop.gif"><p><strong><font color="#FFFFFF">LOẠI SẢN PHẨM</font></strong></p></td>
        </tr>
      <tr>
        <td width="51"><img src="images/kids_dep.gif"/></td>
        <td width="137"><a><font color="#0000FF" >Dép</font></a></td>
      </tr>
      <tr>
        <td width="51"><img src="images/batavai_Icon.png"/></td>
        <td width="137"><a><font color="#0000FF" >Giầy thể thao</font></a></td>
      </tr>
      <tr>
        <td width="51"><img src="images/men_daytay.gif"/></td>
        <td width="137"><a><font color="#0000FF">Giầy tây</font></a></td>
      </tr>
      <tr>
        <td width="51"><img src="images/nu_thoitrang.gif"/></td>
        <td width="137"><font color="#0000FF"><a>Giầy cao gót</a></font></td>
      </tr>
      <tr>
        <td width="51"><img src="images/men_sandal.gif"/></td>
        <td width="137"><a><font color="#0000FF">Sandals</font></a></td>
      </tr>
      <tr>
        <td width="51"><img src="images/kids_hai.gif"/></td>
        <td width="137"><font color="#0000FF">Hài</font></td>
      </tr>
    </table></td>
    <td colspan="4" valign="top"><!-- InstanceBeginEditable name="MainContent" --><table width="100%" border="1" cellspacing="0" cellpadding="5">
            <tr bgcolor="#666666">
              <td background="images/Bartop.gif"><strong><font color="#FFFFFF">THÔNG TIN NGƯỜI MUA HÀNG</font></strong></td>
            </tr>
            <tr>
                <td>Tên:<%=KhachHangDAO.layThongTinKhachHang(Kh).getTenKhachHang()%> </td>
            </tr>
            <tr>
            	<td>Địa chỉ:<%=KhachHangDAO.layThongTinKhachHang(Kh).getDiaChi()%></td>
            </tr>
              <tr>
            	<td>Email:<%=KhachHangDAO.layThongTinKhachHang(Kh).getEmail()%></td>
            </tr>
             <tr>
            	<td>Số điện thoại:<%=KhachHangDAO.layThongTinKhachHang(Kh).getSoDienThoai()%></td>
            </tr>
            </table>
        	<table width="100%" border="1" cellspacing="0" cellpadding="5">
            <tr bgcolor="#666666">
             
            </tr>
            </table>
            <br/>
    
             <table width="100%" border="1" cellspacing="0" cellpadding="5">
            <tr bgcolor="#666666">
              <td background="images/Bartop.gif"><strong><font color="#FFFFFF">LƯỢC SỬ MUA HÀNG</font></strong></td>
            </tr>
            	<td>
                <table width="100%" border="1" cellspacing="0" cellpadding="5">
            	  <tr align="center" bgcolor="#CCCCCC">
            	    <td width="6%"><strong>STT</strong></td>
            	    <td width="12%"><strong>HÌNH</strong></td>
            	    <td width="21%" ><strong>TÊN SẢN PHẨM</strong></td>
            	    <td width="15%"><strong>S. LƯỢNG</strong></td>
            	    <td width="13%"><strong>G. BÁN</strong></td>
            	    <td width="14%"><strong>T.  TIỀN</strong></td>
            	    <td width="19%"><strong>THỜI GIAN MUA</strong></td>
                     <%
                             double tongTien =0;
                    for (int i = 0; i < luocSuMuaHang.size(); i++) {
                        SanPham s = luocSuMuaHang.get(i);
                        tongTien += s.getGiaBan() * s.getSoLuong();
                  %>
            	  <tr valign="top">
            	    <td align="center" bgcolor="#FFFFFF"><%=i+1%></td>
            	    <td width="9%" align="center" bgcolor="#FFFFFF"><a href="#"><img src="images/GiayTheThao.png" alt="#" width="57" height="85" border="0" /></a></td>
            	    <td bgcolor="#FFFFFF"><a href="#"><%=s.getTenSanPham()%></a></td>
            	    <td align="right" bgcolor="#FFFFFF"><%=s.getSoLuong()%></td>
            	    <td align="right" bgcolor="#FFFFFF"><%=s.getGiaBan()%></td>
            	    <td align="right" bgcolor="#FFFFFF"><%=s.getGiaBan()*s.getSoLuong()%></td>
            	    <td align="center" bgcolor="#FFFFFF">22-10-2012</td>
                      <%}%>
            	  <tr valign="top">
            	    <td colspan="5" align="right">Tổng tiền</td>
            	    <td colspan="2" align="center"><strong><font color="#FF0000">400.000 VNĐ</font></strong></td>
          	    </tr>   
                   
          	    </table>
                <br/>
                </td>
            </tr>
            </table><!-- InstanceEndEditable --></td>
  </tr>
  <tr align="center">
    <td colspan="5" background="images/Bartop.gif">&nbsp;</td>
  </tr>
  <tr align="center">
    <td colspan="5">
      <p align="right"><a><font color="#0000FF"><strong>Đăng nhập &nbsp;&nbsp;  </strong></font></a> <a><font color="#0000FF"><strong>Đăng ký&nbsp;</strong></font></a></p></td>
  </tr>
  <tr align="center">
    <td colspan="5"><strong>@ 2012 Le Khanh Nhac </strong> <a href="#" target="_blank">Terms &amp; Privacy</a></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
